import urllib
from urllib import request
from urllib import parse
import json
import requests

url = 'http://www.glidedsky.com/level/web/crawler-basic-1'
# response = request.urlopen(url)
# if response.status==200:
#     # print(dir(response))
#     response_typle=response.read()
#     # print(response_typle)
#     response_text=response_typle.decode('utf-8')
#     # print(response_text)
#     response_json = json.loads(response_text)
#     print(response_json)
#
res =requests.get(url)
print(res.status_code)
if res.status_code==200:
    print(dir(res.text))




# res= request.Request(url,method='GET',headers={
# 'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36'
# })
# response = request.urlopen(res)
# if response.status==200:
#     # print(dir(response))
#     response_typle=response.read()
#     response_text=response_typle.decode('utf-8')
#     response_json = json.loads(response_text)
#     print(response_json,response_json['headers']['User-Agent'],response_json['args'])


# data = {'name':'yjy','age':18}
# data_type=parse.urlencode(data).encode('utf-8')
# res= request.Request(url,method='POST',headers={
# 'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36'
# ,'Content-Type':'application/x-www-form-urlencoded'},data=data_type)

# json_data=json.dumps(data).encode('utf8')
# res= request.Request(url,method='POST',headers={
# 'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36'
# ,'Content-Type':'application/json'},data=json_data)


# response = request.urlopen(res)
# if response.status==200:
#     # print(dir(response))
#     response_type=response.read()
#     response_text=response_type.decode('utf-8')
#     response_json = json.loads(response_text)
#     print(response_json)
